package com.itheima.ssm.service.impl;


import com.itheima.ssm.dao.ItemDao;
import com.itheima.ssm.pojo.Item;
import com.itheima.ssm.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("itemServicessm")
@Transactional   //事务注解
public class ItemServiceImpl implements ItemService {

    //依赖dao
    @Autowired()
    @Qualifier("itemDaossm")
    private ItemDao itemDao;

    //查询全部
    @Override
    public List<Item> findAll() {
        //调用dao
        return itemDao.findAll();
    }

    @Override
    public List<Item> findName(Item item) {
        return itemDao.findName(item);
    }


    //添加方法
    @Override
    public void insertItem(Item item) {
        itemDao.insertItem(item);
    }
}
